<?php

session_start();

// this sets variables in the session 

include_once('connection.php');

$productID = $_POST['id'];
//$date = date(y - m - d, time());
//$date = date("l", mktime(0, 0, 0, 7, 1, 2000));
$date = date('y-m-d');
$userID = $_SESSION['id'];

$arrlength=count($_SESSION['cart']);

$_SESSION['cart'][$arrlength]= $productID .','. $userID;


//..$sql = "insert into `cart` (productId,userId,buyDate,active)
//..    				VALUES ('$productID','$userID','".date("m.d.y")."   ',1) ";
//..$result = mysql_query($sql);


$count = 0;
$userID = $_SESSION['id'];
//                echo $userID;
//                    $count = 0;
//..$sql = "SELECT * FROM `cart` WHERE active = 1 AND userId = " . $userID . "";
//..$result = mysql_query($sql);
//                    while($row=  mysql_fetch_array($result)){
//                        $count++;
//                    }
//..$count = mysql_num_rows($result);
//                echo $count;
echo '<img src="images/cart.png" width="25px"/>
    <p id="cartParagraph" content="' . ($arrlength + 1 ) . '">[' . ($arrlength + 1 ) . ']</p>';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
